#include "junix.h"
using namespace std;

struct Jgenerate
{
	int value_;
	Jgenerate(int n):value_(n){ }
	int operator()()
	{
		return value_++;
	}
};

int main(int argc, char **argv)
{
	vector<int> vi(20);
	generate(vi.begin(),
			vi.end(),
			Jgenerate(0));

	copy(vi.begin(),
			vi.end(),
			ostream_iterator<int>(cout, " "));
	cout<<endl;

	remove_copy_if(vi.begin(),
			vi.end(),
			ostream_iterator<int>(cout," "),
			bind1st(greater<int>(),9)
			);
	cout<<endl;

	remove_copy(vi.begin(),
			vi.end(),
			ostream_iterator<int>(cout," "),
			9);
	cout<<endl;

	remove(vi.begin(),
			vi.end(),
			9);
	copy(vi.begin(),vi.end(),
			ostream_iterator<int>(cout," "));
	cout<<endl;

	remove_if(vi.begin(),vi.end(),
			bind2nd( less<int>(), 8));
	copy(vi.begin(),vi.end(),
			ostream_iterator<int>(cout," "));
	cout<<endl;
}
